package com.finals.function;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

public class SplashActivity extends BaseActivity implements OnClickListener, Runnable {

	ImageView appView;

	Handler mHandler;

	long time = 2 * 1000L;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_splash);
		InitData();
		InitView();
	}

	private void InitData() {
		mHandler = new Handler(Looper.getMainLooper());
		mApp.ShowTouch();
	}

	private void InitView() {
		appView = (ImageView) findViewById(R.id.app_bg);
		appView.setOnClickListener(this);
		mHandler.postDelayed(this, time);
	}

	@Override
	public void onClick(View view) {
		if (view.equals(appView)) {

		}
	}

	@Override
	public void run() {
		Intent intent = new Intent(this, MainActivity.class);
		startActivity(intent);
		this.finish();
	}

	@Override
	protected void onDestroy() {
		if (mHandler != null) {
			mHandler.removeCallbacksAndMessages(null);
		}
		super.onDestroy();
	}

}
